﻿@inject IDataCacheService _dataCacheService
@inject NavigationManager NavigationManager
@inject IEventService _eventService

<CnGalWebSite.Components.Containers.MasaTitleContainer Title="基本信息" Icon="@IconType.Infor.ToIconString()" Collapable Class="@Class">
    <MRow>
        <MCol Cols="12" Md="6">
            <MTextField @bind-Value="Model.UserName" Label="用户名" />
         </MCol>
         <MCol Cols="12" Md="6">
             <CnGalWebSite.Components.Inputs.MasaDatePicker @bind-NullableValue="Model.Birthday" Label="生日" ShowTime="false" Nullable Class="col-12 col-sm-6" />
         </MCol>
        <MCol Cols="12">
            <MTextField @bind-Value="Model.PersonalSignature" Label="个性签名" />
        </MCol>
         <MCol Cols="12">
             <CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaAlert Type="AlertTypes.Info" Class="mt-2 mb-2" Color="primary">
                 点击查看<a @onclick="OnClickQuestion" class="primary--text fw-bold">如何获取SteamId</a> ，Steam个人资料隐私设置<strong>【游戏详情】</strong>需要选择<strong>【公开】</strong>哦
             </CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaAlert>
         </MCol>
        <MCol Cols="12" Md="6">
             <MCheckbox @bind-Value="Model.CanComment" Label="允许游客留言" />
         </MCol>
        <MCol Cols="12" Md="6">
             <MCheckbox @bind-Value="Model.IsShowGameRecord" Label="在主页展示游玩记录" />
         </MCol>
         <MCol Cols="12">
             <div>展示的头衔</div>
             <div style="display:flex;">
                 @foreach (var item in Model.Ranks)
                {
                    <MCheckbox @bind-Value="item.IsShow" Label="@item.Name" Class="me-4 mt-2" />

                }
            </div>
        </MCol>
     </MRow>
</CnGalWebSite.Components.Containers.MasaTitleContainer>

@code {
    [Parameter]
    public EditUserDataViewModel Model { get; set; } = new EditUserDataViewModel();
    [Parameter]
    public string Class { get; set; }

    public void OnClickQuestion()
    {
        _eventService.OpenNewPage(NavigationManager.BaseUri + "articles/index/5");

    }
}
